package com.demo.springcloud.service.impl;

import com.demo.springcloud.dao.UserDao;
import com.demo.springcloud.entity.User;
import com.demo.springcloud.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;
    @Override
    public int save(User user) {
        int result = userDao.save(user);
        return result;
    }

    @Override
    public int deleteById(Long id) {
        int result = userDao.deleteById(id);
        return result;
    }

    @Override
    public int update(User user) {
        int result = userDao.update(user);
        return result;
    }

    @Override
    public List<User> selectAll() {
        List<User> users = userDao.selectAll();
        return users;
    }

    @Override
    public User selectById(Long id) {
        User user = userDao.selectById(id);
        return user;
    }
}
